/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pt.iscte.iul.dcti.pa.gspas.util;

import java.util.Collection;

/**
 *
 * @author Gedsimon Pereira - 58554
 * @contact gspas@iscte.pt
 *
 */
public enum PropertyType {

    BOOLEAN,
    INT,
    DOUBLE,
    STRING,
    COLLECTION,
    ENUM,
    VOID,
    COMPLEX;

    public static PropertyType getPropertyFromClass(Class type) {
        if (type.isEnum()) {
            return ENUM;
        } else if (type.isPrimitive() && type.equals(boolean.class)) {
            return BOOLEAN;
        } else if (type.isPrimitive() && type.equals(int.class)) {
            return INT;
        } else if (type.isPrimitive() && type.equals(double.class)) {
            return DOUBLE;
        } else if (type.equals(String.class)) {
            return STRING;
        } else if (Collection.class.isAssignableFrom(type)) {
            return COLLECTION;
        }
        return COMPLEX;
    }
}
